package com.heima.e_commerce;

import java.util.ArrayList;

public class Order {
    private ArrayList<Member> me;
    private ArrayList<Product> list;
    public Order() {
    }

    public Order(ArrayList<Member> me, ArrayList<Product> list) {
        this.me = me;
        this.list = list;
    }

    public ArrayList<Member> getMe() {
        return me;
    }

    public void setMe(ArrayList<Member> me) {
        this.me = me;
    }

    public ArrayList<Product> getList() {
        return list;
    }

    public void setList(ArrayList<Product> list) {
        this.list = list;
    }

    //添加商品方法
    public void addProduct(Product product) {
        list.add(product);
    }


    //打印商品信息
    public void printInvoice() {
        for (int i = 0; i < me.size(); i++) {
            Member m1 = me.get(i);
            m1.display();
        }
        double allprice = 0;
        for (int i = 0; i < list.size(); i++) {
            Product p1 = list.get(i);
            allprice += p1.getPrice();
            p1.display();
        }
        System.out.println("总金额" + allprice);
    }
}
